-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
annotate: add --fallback-dot-license option #823
annotate: add --fallback-dot-license option #823
Conversation
This new option creates a .license file for any non-binary file whose extension is unknown to reuse. Known or binary files are handled as usual. Reminder: files detected as binary are automatically supported with a .license file.
Inject opened PR number into changelog entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @anthony-loiseau-act !
I love this feature proposal a lot. I just have one change I would make in moving some logic, and one improvement that should have been made anyway.
Are you happy to provide a new patch with the feedback? I'm also happy to follow up myself.
@@ -755,7 +767,7 @@ def run(args: Namespace, project: Project, out: IO[str] = sys.stdout) -> int: | |||
force_multi=args.multi_line, | |||
) | |||
if not args.skip_unrecognised: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove a lot of logic elsewhere and change this to
if not args.skip_unrecognised: | |
if not args.skip_unrecognised or args.fallback_dot_license: |
This reduces passing the parcel, and matches where skip_unrecognised
is used.
parser.add_argument( | ||
"--fallback-dot-license", | ||
action="store_true", | ||
help=_("Write a .license file for unrecognised files"), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use ArgumentParser.add_mutually_exclusive_group for --fallback-dot-license
, --skip-unrecognised
, and --force-dot-license
?
Incidentally, 'Write' should be lower-case 'write'.
I would be pleased to give it a try if delay is not a big matter (since I am not very familiar with python and this code area). I think I can made it within a week max, depending on the time I take to more widely understand involved parts of the code. |
This is no longer needed with #851 merged. Thank you! |
reuse annotate
defaults to fail when it reaches unrecognized files, and to ignore them when--skip-unrecognised
option is given. When annotating a large set of files at once, creating a .license file for unrecognized files can be handy instead.This PR creates a new
--fallback-dot-license
option for this case, making it easier to annotate a large repository with various file kinds.This new option creates a .license file for any non-binary file whose extension is unknown to reuse. Known or binary files are handled as usual. Reminder: files detected as binary are automatically supported with a .license file.